package com.scommunity.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.scommunity.admin.vo.EmpQO;
import com.scommunity.domain.Emp;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Mapper
@Transactional(rollbackFor = Exception.class)
public interface EmpMapper extends BaseMapper<Emp> {
    List<Emp> findPageInfoByCondition(EmpQO empQO);

    @Select("select * from sc_emp")
    List<Emp> findAll();

    @Select("select * from sc_emp where emp_id = #{empId}")
    Emp getInfoByEmpId(Long empId);

    @Insert("insert into sc_emp values(#{empId},#{empAccount},#{empPassword},1,#{roleId})")
    void add(Emp emp);

    void update1(Emp emp);

    @Delete("delete from sc_emp where emp_id = #{id}")
    void del(String id);

    @Select("select emp_status from sc_emp where emp_id = #{id}")
    int getStatuseById(String id);

}
